<?php 
header('content-type:text/html; charset=utf-8');
@$name=$_REQUEST['name'];
session_start();

$pdo=new PDO('mysql:dbname=ton;charset=utf8','root');
$s=$pdo->prepare('select * from user');
$s->execute(array('name'=>$name));
$user=$s->fetchAll(PDO::FETCH_NAMED);
?>
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap 模板</title>
	  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" charset="UTF-8" >
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <link href="css/bootstrap.min.css" rel="stylesheet">
      <script src="js/jquery-1.11.1.min.js"></script>
      <script src="js/bootstrap.min.js"></script>
      <!--[if lt IE 9]>
         <script src="js/html5shiv.js"></script>
         <script src="js/respond.min.js"></script>
      <![endif]-->
   </head>
   <style>
   </style>
   <body>
   <div class="container">
      	<div class="row">
      	<div class="col-xs-4"></div>
      	<div class="col-xs-4">
      		<nav class="navbar navbar-default">
				<form class="navbar-form navbar-left" action="sou.php" method="post">
      		  		<div class="input-group">
         				 <input type="text" class="form-control" placeholder="搜索" name="name">
		 					 <span class="input-group-btn">
        						<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>
      		 	 				</div>
      		 	 				</span>
        					</form>
						<ul class="nav navbar-nav">
							<li class="dropdown">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-th-list"></span>     通讯录</a>
								     <ul class="dropdown-menu">
								         <li><a href="th3.php">添加</a></li>
								            <li class="divider"></li>
								            <li><a href="th2.php">列表</a></li>
								          </ul>
								        </li>
								      </ul>
								</nav>
								<div class="panel panel-default">
								<div class="panel-heading">
   					<div class="title" data-toggle="collapse" data-target="#xx" data-parent="#pid"><h4>通讯录列表　　　　　<?php 
									if(isset($_SESSION['yazi'])){
										print_r("<a href='logout.php'>点击退出</a>");
											}else{
											header('Refresh:2;url=/login.php');
												die('<h3>请先登录</h3><a>返回重新登录</a>');
													}
													?>
			  										</h4></div>
				</div>
				<div id="xx">
				<div class="modal-body">
				<?php for($i=0;$i<count($user);$i++){ ?>
				<h5>姓名：<?php echo $user[$i]['name']?></h5><h5>手机：<?php echo $user[$i]['shou']?>　　　　<?php print_r("<a href='san.php?id={$user[$i]['id']}'>删除</a>")?>
				<a href='bian.php?id=<?php echo $user[$i]['id'];?>'>编辑</a>
				<hr></h5>
				<?php }?>
					</div>
					</div>
				</div>
			</div>
			<div class="col-xs-4"></div>
			</div>
		</div>
   </body>
</html>